/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.restfb;


/**
 *
 * @author Drazzco
 */
import br.great.config.PhotomapConstants;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;


//Esta classe possui métodos que criam e escrevem o arquivo Token.txt
//onde fica guardado o código de verificação do Facebook para o usuário.
public class TokenFile {


public static PrintStream selectTextWrite(String name) throws FileNotFoundException{
   
        File file = new File(name + "Token.txt");

        if (! file.exists()) {
         return new PrintStream (file);
        }
        else{
            return null;
        }



    }


public static String getText(String name) throws FileNotFoundException, IOException{
  
        File file = new File(name + "Token.txt");

        if (! file.exists()) {
            System.out.println(PhotomapConstants.FILENOTFOUND);
        return null;
        }
        else{
        BufferedReader br = new BufferedReader(new FileReader(file));
        StringBuffer bufSaida = new StringBuffer();

        String linha;
        while( (linha = br.readLine()) != null ){
           bufSaida.append(linha);
        }
        br.close();
        return bufSaida.toString();
    }
}
}




